package place;

import java.util.ArrayList;
import java.util.Scanner;

import PJ.Entrance;
import PJ.Player;
import card.CardSystem;

public class CardShop extends Land {
	CardShop(int x, int y,String name) {
		this.i = x;
		this.j = y;		
		this.name=name;
	}

	public void printInformation(int step) {
		System.out.println("这里是卡牌商店~欢迎选购卡牌");
	}
	@Override
	public void printaction(int step,int namei){
		Player player=new Player();
		int[] cards;
		for(int i=0;i<Entrance.players.size();i++){
			if(Entrance.players.get(i).getNamei()==namei){
				player=Entrance.players.get(i);
			}
		}
		System.out.println("欢迎来到"+Landindex.mark[step].name);	
		System.out.println("名称"+"\t\t"+"功能"+"\t\t"+"类型"+"\t\t"+"价格"+"\t\t"+"适用范围");
		for(int i=0;i<=16;i++){
			System.out.println(i+":"+CardSystem.cardsystem[i].getName()+"\t\t"+CardSystem.cardsystem[i].getFunction()+"\t\t"+CardSystem.cardsystem[i].getType()+"\t\t"+CardSystem.cardsystem[i].getPoint()+"\t\t"+CardSystem.cardsystem[i].getRange());
		}
		System.out.println("请选购,退出请输入99");
		Scanner in=new Scanner(System.in);
		int inner=in.nextInt();
			switch(inner){
			default:			
			boolean x=player.getPoint()>CardSystem.cardsystem[inner].getPoint();
			if(x){
				System.out.println("购买成功，您得到一张"+CardSystem.cardsystem[inner].getName());
				cards=player.getCards();
				cards[inner]++;
				player.setPoint(player.getPoint()-CardSystem.cardsystem[inner].getPoint());
				System.out.println("还有什么想要的么");
				inner=in.nextInt();
				break;			
			}else{
				System.out.println("很抱歉，您的余额不足,请再看看吧，退出请输入99");				
				inner=in.nextInt();
				break;
			}
			case 99:
				System.out.println("谢谢您的光临");				
			}	
	}
	@Override
	public char getchart() {
		// TODO Auto-generated method stub
		return '道';
	}
	public char getinitialchart() {
		return '道';
		// TODO Auto-generated method stub
	}
}
